// ts接口
import {
  TetrisItemObj,
  ExhibitionItemObj,
} from '../interface/tetrisItemInterface'

/**
 * @筛选俄罗斯方块成员数组
 * square田字型
 * bar长条形
 * sShape上下横排两个类s型
 * zShape上下横排两个类z型
 * lShape长竖一横两个类L型
 * jShape长竖一横两个类J型
 * tShape长横一竖类T型
 */
export const tetrisItemList: string[] = [
  'square',
  'bar',
  'sShape',
  'zShape',
  'lShape',
  'jShape',
  'tShape',
]

/**
 * @俄罗斯方块成员原始数据对象
 */
// ------------------------------------------------------------------------------
export const tetrisItemObj: TetrisItemObj = {
  // square田字型
  square: {
    // 状态类型筛选数组
    // ================================================================
    stateList: ['top'],

    // 状态类型筛选对象
    // ================================================================
    stateObj: {
      // 上方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      top: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 1 },
        ],
        // 最左边的点数组
        leftSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
        ],
        // 最右边的点数组
        rightSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 1 },
        ],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
        ],
      },
    },
  },

  // bar长条形
  // ------------------------------------------------------------------------------
  bar: {
    // 状态类型筛选数组
    // ================================================================
    stateList: ['top', 'down'],

    // 状态类型筛选对象
    // ================================================================
    stateObj: {
      // 上方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      top: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
          { portrait: 0, transverse: 3 },
        ],

        // 最左边的点数组
        leftSpot: [{ portrait: 0, transverse: 0 }],

        // 最右边的点数组
        rightSpot: [{ portrait: 0, transverse: 3 }],

        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
          { portrait: 0, transverse: 3 },
        ],
      },

      // 下方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      down: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -2, transverse: 0 },
          { portrait: -3, transverse: 0 },
        ],
        // 最左边的点数组
        leftSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -2, transverse: 0 },
          { portrait: -3, transverse: 0 },
        ],
        // 最右边的点数组
        rightSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -2, transverse: 0 },
          { portrait: -3, transverse: 0 },
        ],
        // 最下边的点数组
        downSpot: [{ portrait: 0, transverse: 0 }],
      },
    },
  },

  // sShape上下横排两个类s型
  // ------------------------------------------------------------------------------
  sShape: {
    // 状态类型筛选数组
    // ================================================================
    stateList: ['top', 'down'],

    // 状态类型筛选对象
    // ================================================================
    stateObj: {
      // 上方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      top: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 1 },
          { portrait: -1, transverse: 2 },
        ],

        // 最左边的点数组
        leftSpot: [{ portrait: 0, transverse: 0 }],

        // 最右边的点数组
        rightSpot: [{ portrait: -1, transverse: 2 }],

        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 2 },
        ],
      },

      // 下方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      down: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 0 },
        ],
        // 最左边的点数组
        leftSpot: [
          { portrait: -1, transverse: 0 },
          { portrait: -2, transverse: 0 },
        ],
        // 最右边的点数组
        rightSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 1 },
        ],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 0 },
        ],
      },
    },
  },

  // zShape上下横排两个类z型
  // ------------------------------------------------------------------------------
  zShape: {
    // 状态类型筛选数组
    // ================================================================
    stateList: ['top', 'down'],

    // 状态类型筛选对象
    // ================================================================
    stateObj: {
      // 上方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      top: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 1 },
        ],

        // 最左边的点数组
        leftSpot: [{ portrait: -1, transverse: 0 }],

        // 最右边的点数组
        rightSpot: [{ portrait: 0, transverse: 2 }],

        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
          { portrait: -1, transverse: 0 },
        ],
      },

      // 下方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      down: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 1 },
        ],
        // 最左边的点数组
        leftSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
        ],
        // 最右边的点数组
        rightSpot: [
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 1 },
        ],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 1 },
        ],
      },
    },
  },

  // lShape长竖一横两个类L型
  // ------------------------------------------------------------------------------
  lShape: {
    // 状态类型筛选数组
    // ================================================================
    stateList: ['top', 'right', 'down', 'left'],

    // 状态类型筛选对象
    // ================================================================
    stateObj: {
      // 上方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      top: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 0 },
          { portrait: -2, transverse: 0 },
        ],

        // 最左边的点数组
        leftSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -2, transverse: 0 },
        ],

        // 最右边的点数组
        rightSpot: [{ portrait: 0, transverse: 1 }],

        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
        ],
      },

      // 下方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      down: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 1 },
          { portrait: -2, transverse: 0 },
        ],
        // 最左边的点数组
        leftSpot: [{ portrait: -2, transverse: 0 }],
        // 最右边的点数组
        rightSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 1 },
        ],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -2, transverse: 0 },
        ],
      },

      // 左边时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      left: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
          { portrait: -1, transverse: 2 },
        ],
        // 最左边的点数组
        leftSpot: [{ portrait: 0, transverse: 0 }],
        // 最右边的点数组
        rightSpot: [
          { portrait: 0, transverse: 2 },
          { portrait: -1, transverse: 2 },
        ],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
        ],
      },

      // 右边时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      right: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 1 },
          { portrait: -1, transverse: 2 },
        ],
        // 最左边的点数组
        leftSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
        ],
        // 最右边的点数组
        rightSpot: [{ portrait: -1, transverse: 2 }],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 1 },
          { portrait: -1, transverse: 2 },
        ],
      },
    },
  },

  // jShape长竖一横两个类J型
  // ------------------------------------------------------------------------------
  jShape: {
    // 状态类型筛选数组
    // ================================================================
    stateList: ['top', 'right', 'down', 'left'],

    // 状态类型筛选对象
    // ================================================================
    stateObj: {
      // 上方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      top: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 1 },
        ],

        // 最左边的点数组
        leftSpot: [{ portrait: 0, transverse: 0 }],

        // 最右边的点数组
        rightSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 1 },
        ],

        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
        ],
      },

      // 下方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      down: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -2, transverse: 0 },
          { portrait: -2, transverse: 1 },
        ],
        // 最左边的点数组
        leftSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -2, transverse: 0 },
        ],
        // 最右边的点数组
        rightSpot: [{ portrait: -2, transverse: 1 }],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -2, transverse: 1 },
        ],
      },

      // 左边时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      left: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 2 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 1 },
          { portrait: -1, transverse: 2 },
        ],
        // 最左边的点数组
        leftSpot: [{ portrait: -1, transverse: 0 }],
        // 最右边的点数组
        rightSpot: [
          { portrait: 0, transverse: 2 },
          { portrait: -1, transverse: 2 },
        ],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 2 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 1 },
        ],
      },

      // 右边时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      right: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
          { portrait: -1, transverse: 0 },
        ],
        // 最左边的点数组
        leftSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
        ],
        // 最右边的点数组
        rightSpot: [{ portrait: 0, transverse: 2 }],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
        ],
      },
    },
  },

  // tShape长横一竖类T型
  // ------------------------------------------------------------------------------
  tShape: {
    // 状态类型筛选数组
    // ================================================================
    stateList: ['top', 'right', 'down', 'left'],

    // 状态类型筛选对象
    // ================================================================
    stateObj: {
      // 上方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      top: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
          { portrait: -1, transverse: 1 },
        ],

        // 最左边的点数组
        leftSpot: [{ portrait: 0, transverse: 0 }],

        // 最右边的点数组
        rightSpot: [{ portrait: 0, transverse: 2 }],

        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: 0, transverse: 1 },
          { portrait: 0, transverse: 2 },
        ],
      },

      // 下方时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      down: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 1 },
          { portrait: -1, transverse: 2 },
        ],
        // 最左边的点数组
        leftSpot: [{ portrait: -1, transverse: 0 }],
        // 最右边的点数组
        rightSpot: [{ portrait: -1, transverse: 2 }],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 2 },
        ],
      },

      // 左边时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      left: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 1 },
        ],
        // 最左边的点数组
        leftSpot: [{ portrait: -1, transverse: 0 }],
        // 最右边的点数组
        rightSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 1 },
        ],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 1 },
          { portrait: -1, transverse: 0 },
        ],
      },

      // 右边时
      // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      right: {
        // 所有坐标点数组
        allSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -1, transverse: 1 },
          { portrait: -2, transverse: 0 },
        ],
        // 最左边的点数组
        leftSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 0 },
          { portrait: -2, transverse: 0 },
        ],
        // 最右边的点数组
        rightSpot: [{ portrait: -1, transverse: 1 }],
        // 最下边的点数组
        downSpot: [
          { portrait: 0, transverse: 0 },
          { portrait: -1, transverse: 1 },
        ],
      },
    },
  },
}

/**
 * @俄罗斯方块成员展示颜色数组
 */
// ------------------------------------------------------------------------------
export const tetrisItemColor: string[] = [
  '#0FDEE1',
  '#1CF2A7',
  '#9048F9',
  '#F48C55',
  '#F7C10C',
  '#E93B5D',
  '#3C8DF9',
  '#19E6EF',
  '#FD6EC8',
  '#F8FF01',
  '#658EA6',
  '#B5E994',
]

/**
 * @提示屏幕成员展示原始数据对象
 */
// ------------------------------------------------------------------------------
export const exhibitionItemObj: ExhibitionItemObj = {
  square: {
    top: { portrait: 2, transverse: 2, port: 4, tran: 6 },
  },
  bar: {
    top: { portrait: 2, transverse: 1, port: 5, tran: 6 },
    down: { portrait: 4, transverse: 2, port: 6, tran: 5 },
  },
  sShape: {
    top: { portrait: 2, transverse: 2, port: 4, tran: 7 },
    down: { portrait: 3, transverse: 2, port: 5, tran: 6 },
  },
  zShape: {
    top: { portrait: 2, transverse: 2, port: 4, tran: 7 },
    down: { portrait: 3, transverse: 2, port: 5, tran: 6 },
  },
  lShape: {
    top: { portrait: 3, transverse: 2, port: 5, tran: 6 },
    down: { portrait: 3, transverse: 2, port: 5, tran: 6 },
    left: { portrait: 2, transverse: 2, port: 4, tran: 7 },
    right: { portrait: 2, transverse: 2, port: 4, tran: 7 },
  },
  jShape: {
    top: { portrait: 3, transverse: 2, port: 5, tran: 6 },
    down: { portrait: 3, transverse: 2, port: 5, tran: 6 },
    left: { portrait: 2, transverse: 2, port: 4, tran: 7 },
    right: { portrait: 2, transverse: 2, port: 4, tran: 7 },
  },
  tShape: {
    top: { portrait: 2, transverse: 2, port: 4, tran: 7 },
    down: { portrait: 2, transverse: 2, port: 4, tran: 7 },
    left: { portrait: 3, transverse: 2, port: 5, tran: 6 },
    right: { portrait: 3, transverse: 2, port: 5, tran: 6 },
  },
}
